package com.sgb.kjwl.model.entity.self;

import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.sgb.kjwl.model.entity.transport.SingleItemConstant;

import java.math.BigDecimal;

public class GoodsManageItemData implements MultiItemEntity {

    /**
     * 货源id
     */
    private Long id;
    /**
     * 货源No
     */
    private String no;
    /**
     * 运费
     */
    private BigDecimal freight;
    /**
     * 信息费
     */
    private BigDecimal messagePrice;
    /**
     * 货物类型
     */
    private String goodsTypeName;
    /**
     * 重量
     */
    private BigDecimal weight;
    /**
     * 体积
     */
    private BigDecimal volume;
    /**
     * 装货时间
     */
    private Long shipmentTime;
    /**
     * 装货结束时间
     */
    private Long shipmentEndTime;
    /**
     * 货源上下架状态 0下架 1上架
     */
    private String status;
    /**
     * 货源状态 0 待接单（接单中）/竞价中  1 已成交/已转订单   2 已结束/待处理
     */
    private Integer state;
    /**
     * 报价人数
     */
    private Integer offerNum;
    /**
     * 更新时间
     */
    private Long updateTime;
    /**
     * 发货地-省
     */
    private String provinceName;
    /**
     * 发货地-市
     */
    private String cityName;
    /**
     * 发货地-区
     */
    private String districtName;
    /**
     * 途径发货地-省
     */
    private String viaSendProvinceName;
    /**
     * 途径发货地-市
     */
    private String viaSendCityName;
    /**
     * 途径发货地-区
     */
    private String viaSendDistrictName;
    /**
     * 途径目的地-省
     */
    private String viaDestProvinceName;
    /**
     * 途径目的地-市
     */
    private String viaDestCityName;
    /**
     * 途径目的地-区
     */
    private String viaDestDistrictName;
    /**
     * 目的地-省
     */
    private String destProvinceName;
    /**
     * 目的地-市
     */
    private String destCityName;
    /**
     * 目的地-区
     */
    private String destDistrictName;

    /**
     * 货源发布模式 0 普通模式  1 竞价模式
     */
    private Integer pattern;
    /**
     * 订单No
     */
    private String orderNo;
    /**
     * 报价截止时间
     */
    private Long endTime;
    /**
     * 是否是后台添加 1 是 0 不是
     */
    private Integer isManage;
    /**
     * 企业No
     */
    private String companyNo;
    /**
     * 团队No
     */
    private String teamNo;

    private Integer freightUnit;

    //2.0.6新增字段
    private Integer freightType;//运费选项 0一口价 1电议
    private Integer transportType;//用车类型 0 零担 1 整车
    private Integer startPointTime;//装货时间点
    private Integer endPointTime;//装货结束时间点
    //2.0.8新增字段
    private Integer offerAgreed;//报价已处理数量
    private Integer takesOrdersNum;//竞价货源接单已处理数量
    private Integer biddingSupplyOrderNum;// 竞价中接单数量
    //2.1.4新增字段 二级货物类型名
    private String secondGoodsTypeName;

    public String getFreightUnit() {

        if (freightUnit == null) {
            return "";
        }
        switch (freightUnit) {
            case 1:
                return "元/趟";
            case 2:
                return "元/吨";
            case 3:
                return "元/方";
        }
        return "";
    }

    public void setFreightUnit(Integer freightUnit) {
        this.freightUnit = freightUnit;
    }

    /**
     * 是否有报价单位
     */
    public boolean hasOfferNum() {
        if (offerNum == null) {
            return false;
        }
        return offerNum != 0;
    }

    /**
     * 是否有接单单位
     */
    public boolean hasOrderNum() {
        if (biddingSupplyOrderNum == null) {
            return false;
        }
        return biddingSupplyOrderNum != 0;
    }

    /**
     * 是否有已同意报价或已同意接单
     */
    public boolean hasOfferOrOrderAgreed() {
        if (offerAgreed == null && takesOrdersNum == null) {
            return false;
        }
        return (offerAgreed != null && offerAgreed != 0) ||
                (takesOrdersNum != null && takesOrdersNum != 0);
    }

    public BigDecimal getFreight() {
        if (freight == null) {
            return new BigDecimal(0);
        }
        return freight;
    }

    public void setFreight(BigDecimal freight) {
        this.freight = freight;
    }

    public BigDecimal getMessagePrice() {
        if (messagePrice == null) {
            return new BigDecimal(0);
        }
        return messagePrice;
    }

    public void setMessagePrice(BigDecimal messagePrice) {
        this.messagePrice = messagePrice;
    }

    public BigDecimal getWeight() {
        if (weight == null) {
            return new BigDecimal(0);
        }
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    public BigDecimal getVolume() {
        if (volume == null) {
            return new BigDecimal(0);
        }
        return volume;
    }

    public void setVolume(BigDecimal volume) {
        this.volume = volume;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getGoodsTypeName() {
        return goodsTypeName;
    }

    public void setGoodsTypeName(String goodsTypeName) {
        this.goodsTypeName = goodsTypeName;
    }

    public Long getShipmentTime() {
        return shipmentTime;
    }

    public void setShipmentTime(Long shipmentTime) {
        this.shipmentTime = shipmentTime;
    }

    public Long getShipmentEndTime() {
        return shipmentEndTime;
    }

    public void setShipmentEndTime(Long shipmentEndTime) {
        this.shipmentEndTime = shipmentEndTime;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Integer getOfferNum() {
        return offerNum;
    }

    public void setOfferNum(Integer offerNum) {
        this.offerNum = offerNum;
    }

    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public String getProvinceName() {
        return provinceName;
    }

    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }

    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    public String getDistrictName() {
        return districtName;
    }

    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }

    public String getViaSendProvinceName() {
        return viaSendProvinceName;
    }

    public void setViaSendProvinceName(String viaSendProvinceName) {
        this.viaSendProvinceName = viaSendProvinceName;
    }

    public String getViaSendCityName() {
        return viaSendCityName;
    }

    public void setViaSendCityName(String viaSendCityName) {
        this.viaSendCityName = viaSendCityName;
    }

    public String getViaSendDistrictName() {
        return viaSendDistrictName;
    }

    public void setViaSendDistrictName(String viaSendDistrictName) {
        this.viaSendDistrictName = viaSendDistrictName;
    }

    public String getViaDestProvinceName() {
        return viaDestProvinceName;
    }

    public void setViaDestProvinceName(String viaDestProvinceName) {
        this.viaDestProvinceName = viaDestProvinceName;
    }

    public String getViaDestCityName() {
        return viaDestCityName;
    }

    public void setViaDestCityName(String viaDestCityName) {
        this.viaDestCityName = viaDestCityName;
    }

    public String getViaDestDistrictName() {
        return viaDestDistrictName;
    }

    public void setViaDestDistrictName(String viaDestDistrictName) {
        this.viaDestDistrictName = viaDestDistrictName;
    }

    public String getDestProvinceName() {
        return destProvinceName;
    }

    public void setDestProvinceName(String destProvinceName) {
        this.destProvinceName = destProvinceName;
    }

    public String getDestCityName() {
        return destCityName;
    }

    public void setDestCityName(String destCityName) {
        this.destCityName = destCityName;
    }

    public String getDestDistrictName() {
        return destDistrictName;
    }

    public void setDestDistrictName(String destDistrictName) {
        this.destDistrictName = destDistrictName;
    }

    public Integer getPattern() {
        if (pattern == null) {
            return 0;
        }
        return pattern;
    }

    public void setPattern(Integer pattern) {
        this.pattern = pattern;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public Long getEndTime() {
        return endTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }

    public Integer getIsManage() {
        return isManage;
    }

    public void setIsManage(Integer isManage) {
        this.isManage = isManage;
    }

    public String getCompanyNo() {
        return companyNo;
    }

    public void setCompanyNo(String companyNo) {
        this.companyNo = companyNo;
    }

    public String getTeamNo() {
        return teamNo;
    }

    public void setTeamNo(String teamNo) {
        this.teamNo = teamNo;
    }

    public Integer getFreightType() {
        return freightType;
    }

    public void setFreightType(Integer freightType) {
        this.freightType = freightType;
    }

    public Integer getTransportType() {
        return transportType;
    }

    public void setTransportType(Integer transportType) {
        this.transportType = transportType;
    }

    public Integer getStartPointTime() {
        return startPointTime;
    }

    public void setStartPointTime(Integer startPointTime) {
        this.startPointTime = startPointTime;
    }

    public Integer getEndPointTime() {
        return endPointTime;
    }

    public void setEndPointTime(Integer endPointTime) {
        this.endPointTime = endPointTime;
    }

    public Integer getOfferAgreed() {
        return offerAgreed;
    }

    public void setOfferAgreed(Integer offerAgreed) {
        this.offerAgreed = offerAgreed;
    }

    public Integer getTakesOrdersNum() {
        return takesOrdersNum;
    }

    public void setTakesOrdersNum(Integer takesOrdersNum) {
        this.takesOrdersNum = takesOrdersNum;
    }

    public Integer getBiddingSupplyOrderNum() {
        return biddingSupplyOrderNum;
    }

    public void setBiddingSupplyOrderNum(Integer biddingSupplyOrderNum) {
        this.biddingSupplyOrderNum = biddingSupplyOrderNum;
    }

    public String getSecondGoodsTypeName() {
        return secondGoodsTypeName;
    }

    public void setSecondGoodsTypeName(String secondGoodsTypeName) {
        this.secondGoodsTypeName = secondGoodsTypeName;
    }

    @Override
    public int getItemType() {
        return pattern == 0 ? SingleItemConstant.TYPE_ONE : SingleItemConstant.TYPE_TWO;
    }
}
